<?php
namespace app\weixin\controller;


use think\Controller;

class Index extends Controller
{

    public function index()
    {
        //先初始化微信
        $app = app('wechat.official_account');
        $app->server->push(function($message){
            return 'hello,world';
        });
        $app->server->serve()->send();

        $buttons = [
            [
                "type" => "click",
                "name" => "今日歌曲",
                "url"  => "http://www.lgmmy.com/webapp"
            ],
            [
                "name"       => "菜单",
                "sub_button" => [
                    [
                        "type" => "view",
                        "name" => "搜索",
                        "url"  => "http://www.lgmmy.com/webapp"
                    ],
                    [
                        "type" => "view",
                        "name" => "视频",
                        "url"  => "http://v.qq.com/"
                    ],
                    [
                        "type" => "click",
                        "name" => "赞一下我们",
                        "key" => "V1001_GOOD"
                    ],
                ],
            ],
        ];
        $app->menu->create($buttons);
    }
}
